function enduranceToSessionStorage(name, data) {
  typeof data == "object"
    ? sessionStorage.setItem(name, JSON.stringify(data))
    : sessionStorage.setItem(name, data);
}
const store = new Vuex.Store({
  state: {
    rightList: JSON.parse(sessionStorage.getItem("rightList")) || [],
    username: sessionStorage.getItem("username"),
  },
  mutations: {
    setRightList(state, payload) {
      state.rightList = payload.data;
      enduranceToSessionStorage("rightList", payload.data);
    },
    setUserNmae(state, payload) {
      state.username = payload.username;
      enduranceToSessionStorage("username", payload.username);
    },
  },
  actions: {},
  getters: {},
});
export default store